<?php

/* 
 * 把修改后的留言保存数据库里
 */
require 'dbcon.php';
$id=$_GET['id'];
$username=$_REQUEST['username'];
$sex=$_REQUEST['sex'];
$imgurl=$_REQUEST['imgurl'];
$message=$_REQUEST['message'];
$sql="update t_message set username='{$username}',message='{$message}' ,sex='{$sex}',imgurl='{$imgurl}'  where id={$id}";
$rs=$db->query($sql);//执行查询语句$sql，生成结果集$result
$db->close();//关闭数据库连接
if ($rs==true)
{
    echo "<script type='text/javascript'>";    
    echo "window.location.href='index.php'";
    echo "</script>";
}
else   
{
    echo "<script type='text/javascript'>";  
    echo "alert('修改留言失败！');";
    echo "window.location.href='index.php'";
    echo "</script>";
}